//
//  SettingCell.m
//  SinaWebo
//
//  Created by wwj on 16/1/18.
//  Copyright © 2016年 亦心. All rights reserved.
//

#import "SettingCell.h"
#import "SettingItem.h"
#import "SettingArrowItem.h"

@interface SettingCell ()
@property (weak, nonatomic) IBOutlet UIImageView *img;
@property (weak, nonatomic) IBOutlet UILabel *title;
@property (weak, nonatomic) IBOutlet UILabel *subTitle;
@property (weak, nonatomic) IBOutlet UIButton *bageBtn;
@property (weak, nonatomic) IBOutlet UIImageView *arrow;

@end

@implementation SettingCell

+(instancetype)settingCellWithTableView:(UITableView *)tableView{
    static NSString *ID = @"cell";
    SettingCell *cell =  [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[NSBundle mainBundle] loadNibNamed:@"SettingCell" owner:nil options:nil].lastObject;
    }
    return cell;
    
}

-(void)setModel:(SettingItem *)model{
    _model = model;
    _img.image = [UIImage imageNamed:model.icon];
    _title.text = model.title;
    _subTitle.text = model.subTitle;
    if ([_model isKindOfClass:[SettingArrowItem class]]) {
        [self setArrow];
    }
}

-(void)setArrow{
    _bageBtn.hidden = YES;
    _arrow.hidden = NO;
}
@end
